package com.dgut.admin.controller;

import com.dgut.admin.service.WxUserService;
import com.dgut.common.utils.R;
import org.springframework.web.bind.annotation.*;

/**
 * @Author zyq
 * @Date 2022/4/9 15:49
 * @Description TODO
 * @Version 1.0
 **/
@RestController
@RequestMapping("/api/admin/wx-user")
public class WxUserController {

    private final WxUserService wxUserService;

    public WxUserController(WxUserService wxUserService) {
        this.wxUserService = wxUserService;
    }

    /**
     * 微信用户列表
     */
    @GetMapping("/list")
    public R listWxUser(Integer pageNum, Integer pageSize, String name, Integer identity) {
        return R.ok().data(wxUserService.listWxUser(pageNum, pageSize, name, identity));
    }

    /**
     * 微信用户详情信息
     */
    @GetMapping("/{id}")
    public R detailWxUser(@PathVariable("id") Integer id) {
        return R.ok().data(wxUserService.detailWxUser(id));
    }

    /**
     * 禁用微信用户
     */
    @PutMapping("/{id}")
    public R disableUser(@PathVariable("id") Integer id) {
        wxUserService.disableUser(id);
        return R.ok();
    }


}
